﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowDetails.aspx.cs" Inherits="MTRC.ODMS.Web.SOM.Popup.ShowDetails" %>

<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls"
    TagPrefix="APJ" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <base target="_self" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <link href="../../CSS/common.css" rel="stylesheet" type="text/css" />
    <%-- add by gordon 20160222 Spell check on “General Event” description --%>
    <script src="../../SpellChecking/spell.js" type="text/javascript"></script>
    <script language="JavaScript" src="../../Javascript/CommonFunction.js"></script>
    <script language="javascript">
        var pageID;
        var isConfirm = 0;
        var isDisabled = 0;
        function Init() {
            pageID = getQueryString("PageID") 
            //add by benson 2015-09-10 begin
            isConfirm = getQueryString("isConfirm"); //0:true  1:false
            if (isConfirm == 1) {
                var btn = document.getElementById("btnConfirm");
                btn.style.display = "none";
            }
            //add by benson 2015-09-10 end
            var id;
            ///add by benson 2015-06-24  begin
            setReadOnly(true);
            var detail = document.getElementById("txtDetails");
            detail.style.height = document.body.clientHeight - 80;
            ///add by benson 2015-06-24  end
            if (pageID == "COM") {
                id = getQueryString("ID");
                document.getElementById("txtDetails").value = dialogArguments.document.getElementById(id).value;
            }
            else if (pageID == "AdmissionRegistryEntry") {
                id = getQueryString("ID");
                document.getElementById("txtDetails").value = dialogArguments.document.getElementById(id).innerText;
            }
            else if (pageID == "AssetItem") {
                id = getQueryString("ID");
                document.getElementById("txtDetails").value = dialogArguments.document.getElementById(id).innerText;
            }
            ///add by benson 2015-06-24  begin
            else if (pageID == "GeneralEventEntry") {
                id = getQueryString("ID");
                document.getElementById("txtDetails").value = dialogArguments.document.getElementById(id).innerText;
                document.getElementById("btnSpellCheck").style.display = "block"; //add by gordon 20160222 Spell check on “General Event” description
                setReadOnly(false);
            }
            ///add by benson 2015-06-24  end

            // add by dylan 20151010
            isDisabled = getQueryString("isDisabled");
            if (isDisabled == 1) {
                var btn = document.getElementById("btnConfirm");
                btn.style.display = "none";
                document.getElementById("txtDetails").disabled = "disabled";
                //add by gordon 20160222 Spell check on “General Event” description
                if (pageID == "GeneralEventEntry") {
                    document.getElementById("btnSpellCheck").style.display = "none";
                }
                //add end by gordon 20160222 Spell check on “General Event” description
            }
        }
        function setReadOnly(isTrue) {
            if (isTrue == false) {
                document.getElementById("txtDetails").readOnly = false;
                var btn1 = document.getElementById("btnConfirm");
                btn1.disabled = false;
            } else {
                document.getElementById("txtDetails").readOnly = true;
                var btn1 = document.getElementById("btnConfirm");
                btn1.disabled = true;
            }

        }
        ///add by benson 2015-06-24  begin
        function closeWindow() {
            window.returnValue = document.getElementById("txtDetails").value;
            window.close();
        }
        ///add by benson 2015-06-24  end

        function getQueryString(name) {
            var url = window.location.href;
            var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
            var id = ""
            if (reg.test(url)) {
                id = unescape(RegExp.$2.replace(/\+/g, " "));
            }
            return id
        }
        
    </script>
</head>
<body onload="Init();">
    <form id="form1" runat="server">
    <div>
        <table width="100%">
            <tr>
                <td height="">
                    <asp:TextBox ID="txtDetails" runat="server" TextMode="MultiLine" Height="80%" Width="98%"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <%-- update by gordon 20160222 Spell check on “General Event” description --%>
                    <%--
                    <asp:Button ID="btnConfirm" runat="server" OnClientClick="closeWindow();" Text="Confirm" />
                    <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
                    --%>
                    <table>
                        <tr>
                            <td>
                                <asp:ImageButton ID="btnSpellCheck" style="display:none;" OnClientClick="spellURL='../../SpellChecking/SpellCheck.aspx';checkSpellingById('txtDetails');return false;" 
                                ImageUrl="~/Images/Common/G - spellcheck - 32.png" runat="server"  BorderWidth="1px" />
                            </td>
                            <td>
                                <asp:Button ID="btnConfirm" runat="server" OnClientClick="closeWindow();" Text="Confirm" />
                                <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
                            </td>
                        </tr>
                    </table>
                    
                </td>
            </tr>
        </table>
    </div>
    <br />
    </form>
</body>
</html>
